Patterns are generally of variable length. In such cases, it is useful to have repeating operators.
- Use the asterisk ("*") to match the preceding sequence 0 or more times (SmartZone tries to match as many times as possible). For example, the pattern "(sunny )*day" matches "day", "sunny day", "sunny sunny day", etc.
- Plus sign ("+") works the same as "*", but there must be a minimum of one instance of the submatch or characters present. For example, the pattern "(sunny )*day" matches "sunny day", "sunny sunny day", etc., but not "day" alone.
- Use the "?" to match the preceding sequence 0 or 1 time. For example, the pattern "(sunny )?day" will match "day" and "sunny day".
- Adding a "?" to a repeat operator makes the sub-expression minimal or non-greedy. Normally, a repeated expression is greedy, in other words, it matches as many characters as possible. A non-greedy sub-expression matches as few characters as possible.
- Use "{n}" to match the preceding sequence n times. For example, the pattern "(sunny ){2}day" only matches "sunny sunny day".
- Use "{n,m}" to match the preceding sequence between n and m times. For example, the pattern "(sunny ){2,3}day" matches "sunny sunny day" and "sunny sunny sunny day".
- Use "{n,}" to match the preceding sequence at least n times. For example, the pattern "(sunny ){2,}day" matches "sunny sunny day" and "sunny sunny sunny sunny day".
It is preferable to use the most restrictive pattern possible to improve recognition results.